#被动技能【天空中的伙伴：凌鹰】
data merge entity @e[type=minecraft:phantom,tag=ying,limit=1] {Fire:-20}
execute at @a[tag=xiao] run summon minecraft:phantom ~ ~ ~ {Tags:["ying"],Fire:-20,NoAI:1b,Invulnerable:1b,NoGravity:1b}
execute as @a[tag=xiao] at @s run scoreboard players operation @e[type=phantom,tag=ying,distance=0..2] DataID = @s DataID
execute as @a[tag=xiao] run tag @s add lingying
execute as @a[tag=xiao] run tag @s remove xiao

execute as @a[tag=lingying,scores={skCDEntity=3..}] at @s unless block ~ ~-0.5 ~ air run function nw:yingxiong/1yingxiong/01xiao/skill/0yinggui
execute at @e[tag=ying,type=phantom,limit=1] as @a[distance=0..5,tag=lingying] if score @s DataID = @e[type=phantom,tag=ying,limit=1,sort=nearest] DataID run effect give @s night_vision 8 0 false

#控制箭矢伤害
execute as @e[type=minecraft:arrow,nbt={CustomPotionEffects:[{Id:19b}]}] run data merge entity @s {damage:2.4}

#主动技能【旋翔掠杀】
execute as @a[tag=lingying,scores={skEXBottle=1}] at @s run function nw:yingxiong/1yingxiong/01xiao/skill/1luesha
#主动技能【旋翔掠杀】二段：鹰灵装弹
clear @a[tag=lingying,scores={skEXBottle=2,skBow0=1..}] minecraft:crossbow
give @a[tag=lingying,scores={skEXBottle=2,skBow0=1..}] minecraft:crossbow{ChargedProjectiles:[{id:"minecraft:tipped_arrow",Count:1b,tag:{Potion:"CBC",CustomPotionEffects:[{Id:19,Amplifier:3,Duration:60},{Id:2,Amplifier:1,Duration:60}],display:{Name:'[{"text":"强化型：鹰灵箭矢","color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]'}}}],Charged:1b,display:{Name:'[{"text":"鹰灵","color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]',Lore:['{"text":"比起一般Beretta，枪身和滑槽都稍长。","color":"dark_green","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}']},Enchantments:[{id:"minecraft:piercing",lvl:5}],Damage:465} 1
scoreboard players set @a[tag=lingying,scores={skEXBottle=2,skBow0=1..}] skEXBottle 3
#主动技能【旋翔掠杀】三段：落地
execute as @a[tag=lingying,scores={skEXBottle=2..3}] at @s unless block ~ ~-0.5 ~ air run effect give @s speed 1 1 false
execute as @a[tag=lingying,scores={skEXBottle=2..3}] at @s unless block ~ ~-0.5 ~ air run effect give @s speed 2 0 false
execute as @a[tag=lingying,scores={skEXBottle=2..3}] at @s unless block ~ ~-0.5 ~ air run scoreboard players set @s skEXBottle 0

#主动技能【旋翔掠杀】CD
execute as @a[tag=lingying,scores={skCDEXBottle=0}] at @s run function nw:yingxiong/1yingxiong/01xiao/skill/1luesha_cd


#被动技能【鹰灵箭矢】
scoreboard players set @a[tag=lingying,scores={skPlayer=..1,skCDPlayer1=-1}] skCDPlayer1 6
scoreboard players remove @a[tag=lingying,scores={skBow0=1..}] skPlayer 1
scoreboard players set @a[tag=lingying,scores={skBow0=1..}] skBow0 0
execute as @a[tag=lingying,scores={skCDPlayer1=0}] at @s run function nw:yingxiong/1yingxiong/01xiao/skill/0zizhi

#被动技能【天空中的伙伴：凌鹰】
effect give @a[tag=lingying,scores={FireTime=..0}] jump_boost 1 2 true
#被动技能【残缺羽翼】
item replace entity @a[tag=lingying,scores={skCDSnowball=0,skSneakTime=21..}] armor.chest with minecraft:elytra{display: {Name: '[{"text":"凌鹰时制翅膀","color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]'}, Unbreakable: 1} 1
execute as @a[tag=lingying,scores={skCDSnowball=0,skSneak=1..,skSneakTime=..20}] at @s if block ~ ~-1 ~ air run effect give @s levitation 1 5 true
effect clear @a[tag=lingying,scores={skCDSnowball=0,skSneakTime=21..,skSneak=0}] levitation
scoreboard players set @a[tag=lingying,scores={skCDSnowball=0,skSneak=1..}] skSneak 0

execute as @a[tag=lingying] at @s unless block ~ ~-0.5 ~ air run scoreboard players set @s skSneakTime 0
execute as @a[tag=lingying] at @s unless block ~ ~-0.5 ~ air run scoreboard players set @s xiao1 0
execute as @a[tag=lingying] at @s unless block ~ ~-0.5 ~ air run clear @s elytra
#被动技能【残缺羽翼】着火无法获得跳跃提升，漂浮，缓降
effect clear @a[tag=lingying,scores={FireTime=0..}] levitation
effect clear @a[tag=lingying,scores={FireTime=0..}] jump_boost
effect clear @a[tag=lingying,scores={FireTime=0..}] slow_falling
clear @a[tag=lingying,scores={FireTime=0..}] elytra

execute as @a[tag=lingying] run title @s actionbar [{"text":"旋翔掠杀","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDEXBottle","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 残缺羽翼","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDSnowball","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 鹰灵箭矢","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 下一支：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDPlayer1","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
execute as @a[tag=lingying] run title @s actionbar [{"text":"旋翔掠杀","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDEXBottle","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 残缺羽翼","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"正在冷却：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDSnowball","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 鹰灵箭矢","color":"dark_red","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":" 下一支：","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"score":{"objective":"skCDPlayer1","name":"@s"},"color":"aqua","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false},{"text":"s","color":"gold","bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false}]
